from hosting.ftp.models import FTPUser, get_folder_list
from django.forms import ModelForm, BaseModelForm
from django import forms

class FTPForm(ModelForm):
    directory = forms.ChoiceField()

    def __init__(self, request, *args, **kwargs):
       super(FTPForm, self).__init__(*args, **kwargs)
       self.fields['directory'].choices = get_folder_list(request.user)

    class Meta:
        model = FTPUser
        exclude = ('user',)


class FTPFormWOPass(ModelForm):
    directory = forms.ChoiceField()

    def __init__(self, request, *args, **kwargs):
       super(FTPFormWOPass, self).__init__(*args, **kwargs)
       self.fields['directory'].choices = get_folder_list(request.user)

    class Meta:
        model = FTPUser
        exclude = ('user', 'password')

